<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>${sstj}_搜索</title>
    

		<link href="shop/css/shop-detail.css" rel="stylesheet" /> 
		<link href="shop/css/shop-top.css" rel="stylesheet" />
		<link href="shop/css/shop-common.css" rel="stylesheet" />
		<link href="shop/css/shop-footer.css" rel="stylesheet" /> 
	<link href="shop/css/shop-tuan.css" rel="stylesheet" /> 
	
	<script type="text/javascript" src="shop/js/shop-public.js"></script>
	<script type="text/javascript" src="shop/js/shop-menudown.js"></script>
	<script type="text/javascript" src="js/jquery.min.js"></script>
	<jsp:include page="/head.jsp" />
  </head>
  <body>
<c:import url="/news-class.do?mb=header" /> 
		<%@ include file="jsps/top.jsp"  %>
  <div class="yershop_wrapper"> 
   <!-- logo --> 
<%@ include file="jsps/hader.jsp" %>
   <!-- /头部 --> 
   <!-- 菜单 --> 
   <!-- 导航条--> 
   <!-- 导航条--> 
   <div class="menu-wrapper"> 
   <div class="nava"> 
    <div class="nav-all"> 
     <div class="all_class" id="all-class"> 
      <h2 style="margin-top: 0px;"><span class="grid"></span><a href="shop.html"><span>主页</span></a><b></b></h2> 
     </div> 
     
    </div> 
    
    </div>
   </div>
   <!-- /菜单 --> 
   <!-- 主体 --> 
   <div class="commom_wrapper"> 
    <!-- Contents  --> 
    <div class="ml_content"> 
     <div class="goodlist-main"> 
      <div class="lists-position"> 
       
       <div class="salesrank"> 
        <h5 style="margin-top: 0px;background-color: #FFFFFF;"><span style="margin-left: 70px;">销量最佳</span></h5> 
        <ul>
         <!-- 销量排行循环开始 -->
         
       	<c:forEach items="${pai }" var="sg">
         <li>
         <a class="picture" href="shopgoods-1.do?productId=${sg.productId }">
         <img src="${sg.productImgs}" />
         </a> 
         <a class="title" href="shopgoods-1.do?productId=${sg.productId }"> ${sg.productName}</a> 
         <span>￥${sg.productPrice1 }</span> 
         </li> 
         </c:forEach> 
         <!-- 销量排行循环开始 --> 
        </ul> 
       </div> 
      </div> 
      <div class="lists-area"> 
       <p class="serach-title" id="s">"${sstj}"的相关结果</p>
       <ul class="ml_content_top">
        <li <c:if test="${param.order=='2' }">class="active"</c:if> ><a href="product-1.do?name=${sstj}&time=1" class="asc" style="height: 30px;">最新<i></i></a></li>
        <li <c:if test="${param.order=='3' }">class="active"</c:if> ><a href="product-1.do?name=${sstj}&productPrice=1" class="asc" style="height: 30px;">价格<i></i></a></li>
        <li <c:if test="${param.order=='4' }">class="active"</c:if> ><a href="product-1.do?name=${sstj}&sales=1" class="asc" style="height: 30px;">销量<i></i></a></li>
       </ul> 
       <ul class="goodlist"> 
       <c:if test="${display.total==0 }">
        	<img src="shop/images/s404.png" />
        	抱歉！没有找到与“${sstj}”相关的宝贝。
        </c:if>
       <!-- 商品展示循环开始 -->
       	<c:forEach items="${display.list}" var="goods">
       	<li class="face" onmouseover="this.className='facehover'" onmouseout="this.className='face'"> 
        	<a href="shopgoods-1.do?productId=${goods.productId}" class="list-img"> 
        		<img src="${goods.productImgs}" />
        	</a> 
	        <p> 
	        	<a href="shopgoods-1.do?productId=${goods.productId}" class="t2"> ${goods.productName}</a>
	        </p> 
	        <p>
	        	<span class="red">价格：￥${goods.productPrice1}</span>
	        </p> 
        </li> 
        </c:forEach>
        <!-- 商品展示循环结束 -->
       </ul> 
        <!-- 分页 --> 
        <c:if test="${not empty display }">
       <div class="page"> 
        <div> 
        	<c:if test="${p==1}">
        	<a class="prev" href="product-${display.firstPage}.do?name=${sstj}&p=1">«</a>
        	<c:forEach items="${display.navigatepageNums }" var="i">
        		<c:if test="${i==display.pageNum }">
        			<span class="current">${i}</span>
        		</c:if>
        		<c:if test="${i!=display.pageNum}">
        			<a class="num" href="product-${i}.do?name=${sstj}&p=1">${i}</a>
        		</c:if>
        	</c:forEach>	
        	<a class="next" href="product-${display.lastPage}.do?name=${sstj}&p=1">»</a>
         	<span class="rows">共${display.total } 个订单</span>
         	</c:if>
         	
         	<c:if test="${productPrice==1}">
        	<a class="prev" href="product-${display.firstPage}.do?name=${sstj}&productPrice=1">«</a>
        	<c:forEach items="${display.navigatepageNums }" var="i">
        		<c:if test="${i==display.pageNum }">
        			<span class="current">${i}</span>
        		</c:if>
        		<c:if test="${i!=display.pageNum}">
        			<a class="num" href="product-${i}.do?name=${sstj}&productPrice=1">${i}</a>
        		</c:if>
        	</c:forEach>	
        	<a class="next" href="product-${display.lastPage}.do?name=${sstj}&productPrice=1">»</a>
         	<span class="rows">共${display.total } 个订单</span>
         	</c:if>
         	
         	<c:if test="${sales==1}">
        	<a class="prev" href="product-${display.firstPage}.do?name=${sstj}&sales=1">«</a>
        	<c:forEach items="${display.navigatepageNums }" var="i">
        		<c:if test="${i==display.pageNum }">
        			<span class="current">${i}</span>
        		</c:if>
        		<c:if test="${i!=display.pageNum}">
        			<a class="num" href="product-${i}.do?name=${sstj}&sales=1">${i}</a>
        		</c:if>
        	</c:forEach>	
        	<a class="next" href="product-${display.lastPage}.do?name=${sstj}&sales=1">»</a>
         	<span class="rows">共${display.total } 个订单</span>
         	</c:if>
         	
         	<c:if test="${time==1}">
        	<a class="prev" href="product-${display.firstPage}.do?name=${sstj}&time=1">«</a>
        	<c:forEach items="${display.navigatepageNums }" var="i">
        		<c:if test="${i==display.pageNum }">
        			<span class="current">${i}</span>
        		</c:if>
        		<c:if test="${i!=display.pageNum}">
        			<a class="num" href="product-${i}.do?name=${sstj}&time=1">${i}</a>
        		</c:if>
        	</c:forEach>	
        	<a class="next" href="product-${display.lastPage}.do?name=${sstj}&time=1">»</a>
         	<span class="rows">共${display.total } 个订单</span>
         	</c:if>
        </div>
       </div>
       </c:if>
      </div> 
     </div> 
    </div> 
   </div> 
   <!-- 主体 --> 
   <!-- 购物车js --> 
   <script>

   $(document).ready(function(){
	   $("a.search_btn").click(function(){
	 var words=$("input.search").val();
	   if(words){
	 	  document.Searchform.submit();
	   }
	   else{
	   alert("搜索内容不能为空")
	   }
	   });
	 });
   
	//购物车显示与隐藏
	 var Shopcart= document.getElementById('shopping_cart');
     var Goodsmenu= document.getElementById('goods');
            var timerr = null;//定义定时器变量
            //鼠标移入div1或div2都把定时器关闭了，不让他消失
            Shopcart.onmouseover =Goodsmenu.onmouseover = function ()
            {
                Goodsmenu.style.display = 'block';
                clearTimeout(timerr);
            }
            //鼠标移出div1或div2都重新开定时器，让他延时消失
            Shopcart.onmouseout =Goodsmenu.onmouseout = function ()
            {
                //开定时器
                timerr= setTimeout(function () { 
                    Goodsmenu.style.display = 'none'; }, 10);
            }
			
//购物车动态删除
	function delcommon(event)
		{ //获取事件源
event = event ? event : window.event; 
var obj = event.srcElement ? event.srcElement : event.target; 
//这时obj就是触发事件的对象，可以使用它的各个属性 
//还可以将obj转换成jquery对象，方便选用其他元素 
str = obj.innerHTML.replace(/<\/?[^>]*>/g,''); //去除HTML tag

	var $obj = $(obj);
	var str=$obj.parent().prev().html();
	if(obj.rel=="del")
{ var str=obj.name;
var uexist="";
	//全选的实现 定义删的发送路径
	if(uexist){
		var del='/index.php?s=/Home/Shopcart/delItemByuid.html';	
	}
else{
var del='delShoppingCart.goods';
	
	}

$.ajax({
type:'post', //传送的方式,get/post
url:del, //发送数据的地址
data:{sort:str},
 dataType: "json",
success:function(data)
{var $obj = $(obj);
	$obj.parents("li").remove();
	if(data.sum=="0"){  //判断购物车数量是否为0，为0则隐藏底部查看工具
						$("div.sc_goods_foot").hide();
					   	var html='<p class="sc_goods_none" >您的购物车还是空的，赶紧行动吧！</p>';
					   $("ul.sc_goods_ul").html(html);
	}
	else{$("div.sc_goods_foot").show();}

},
error:function (event, XMLHttpRequest, ajaxOptions, thrownError) {
alert(XMLHttpRequest+thrownError); }
		})
}
	} 
//购物车删除结束
</script> 
   <!-- /购物车js --> 
   <!-- 底部 --> 
   <!-- 底部--> 
   <script type="text/javascript" charset="utf-8" src="js/menudown.js"></script> 
  </div> 
 <%@ include file="jsps/footer.jsp" %> 
  </body>
</html>
